package level.editor.view.desktop;

import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import javax.swing.JPanel;

public class DesktopOutlinePane extends JPanel
{
	public static final Integer Z_ORDER = -1;

	public DesktopOutlinePane()
	{
		setOpaque(false);
		this.rect = null;
	}

	public void updateOutlinePanel(Dimension dimension)
	{
		setSize(dimension);
	}

	public void setRectangle(Rectangle rect)
	{
		this.rect = rect;
	}

	@Override
	protected void paintComponent(Graphics g)
	{
		super.paintComponent(g);
		if (rect != null)
		{
			Graphics2D g2 = (Graphics2D) g.create();
			g2.setRenderingHints(new RenderingHints(
					RenderingHints.KEY_ANTIALIASING,
					RenderingHints.VALUE_ANTIALIAS_ON));
			g2.setStroke(new BasicStroke(5));
			g2.setColor(Color.GRAY);
			g2.draw(rect);
			g2.dispose();
		}
	}

	private Rectangle rect;
}
